package com.xplay.xpocker.room;

public class IarMessageTL {
    private IarMessageTL() {

    }

    private static ThreadLocal<Integer> IAR_MESSAGE = new ThreadLocal<>();

    public static void clear() {
        IAR_MESSAGE.remove();
    }

    public static void set(Integer content) {
        IAR_MESSAGE.set(content);
    }

    /**
     * 获取房间信息
     *
     * @return
     */

    public static Integer dec() {
        Integer result = IAR_MESSAGE.get() - 1;
        set(result);
        return result;
    }

    public static Integer inc() {
        Integer result = IAR_MESSAGE.get() + 1;
        set(result);
        return result;
    }


    public static Integer get() {
        Integer result = IAR_MESSAGE.get();
        return result == null ? 0 : result;
    }

}
